<!DOCTYPE html><html class="theme-next gemini use-motion" lang="zh-Hans"><head><meta name="generator" content="Hexo 3.8.0"><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1"><meta name="theme-color" content="#222"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><meta name="google-site-verification" content="_CvUtfZYj94EKoG6BlHUsXy75NrQXbM-vYmUXIG-jDI"><link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css"><link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css"><link href="/css/main.css?v=5.1.3" rel="stylesheet" type="text/css"><link rel="apple-touch-icon" sizes="180x180" href="/favicon.ico?v=5.1.3"><link rel="icon" type="image/png" sizes="32x32" href="/favicon.ico?v=5.1.3"><link rel="icon" type="image/png" sizes="16x16" href="/favicon.ico?v=5.1.3"><link rel="mask-icon" href="/favicon.ico?v=5.1.3" color="#222"><meta name="keywords" content="Hexo,Github,Travis-ci,"><link rel="alternate" href="/atom.xml" title="小小白杨" type="application/atom+xml"><meta name="description" content="概述 Hexo，NodeJS驱动的轻量级静态博客系统。 Github(Pages)，这里用来托管博客源码和发布静态页面。 Travis-ci，持续集成，写博客要坚持，发布也要持续。"><meta name="keywords" content="Hexo,Github,Travis-ci"><meta property="og:type" content="article"><meta property="og:title" content="Hexo+Github+Travis-ci搭建程序员自己的博客"><meta property="og:url" content="https://baiyangliu.github.io/Hexo+Github+Travis-ci搭建程序员自己的博客.html"><meta property="og:site_name" content="小小白杨"><meta property="og:description" content="概述 Hexo，NodeJS驱动的轻量级静态博客系统。 Github(Pages)，这里用来托管博客源码和发布静态页面。 Travis-ci，持续集成，写博客要坚持，发布也要持续。"><meta property="og:locale" content="zh-Hans"><meta property="og:image" content=""><meta property="og:image" content="https://travis-ci.org/baiyangliu/baiyangliu.github.io.svg?branch=raw"><meta property="og:updated_time" content="2018-12-10T12:15:42.849Z"><meta name="twitter:card" content="summary"><meta name="twitter:title" content="Hexo+Github+Travis-ci搭建程序员自己的博客"><meta name="twitter:description" content="概述 Hexo，NodeJS驱动的轻量级静态博客系统。 Github(Pages)，这里用来托管博客源码和发布静态页面。 Travis-ci，持续集成，写博客要坚持，发布也要持续。"><meta name="twitter:image" content=""><script type="text/javascript" id="hexo.configurations">var NexT=window.NexT||{},CONFIG={root:"/",scheme:"Gemini",version:"5.1.3",sidebar:{position:"left",display:"hide",offset:12,b2t:!1,scrollpercent:!1,onmobile:!1},fancybox:!0,tabs:!0,motion:{enable:!0,async:!1,transition:{post_block:"fadeIn",post_header:"slideDownIn",post_body:"slideDownIn",coll_header:"slideLeftIn",sidebar:"slideUpIn"}},duoshuo:{userId:"0",author:"博主"},algolia:{applicationID:"8IYI0XR3E5",apiKey:"aa60ba3284d31eb23d09a7ab3d60bd80",indexName:"baiyangliu",hits:{per_page:7},labels:{input_placeholder:"搜索",hits_empty:"未找到与”<font style='color:red;font-weight:bold;'>${query}</font>“配置的页面",hits_stats:"找到 <font style='color:green;font-weight:bold;'>${hits}</font> 条数据，用时 <font style='color:green;font-weight:bold;'>${time}</font> 毫秒"}}}</script><link rel="canonical" href="https://baiyangliu.github.io/Hexo+Github+Travis-ci搭建程序员自己的博客.html"><title>Hexo+Github+Travis-ci搭建程序员自己的博客 | 小小白杨</title></head><body itemscope="" itemtype="http://schema.org/WebPage" lang="zh-Hans"><div class="container sidebar-position-left page-post-detail"><div class="headband"></div><header id="header" class="header" itemscope="" itemtype="http://schema.org/WPHeader"><div class="header-inner"><div class="site-brand-wrapper"><div class="site-meta"><div class="custom-logo-site-title"><a href="/" class="brand" rel="start"><span class="logo-line-before"><i></i></span> <span class="site-title">小小白杨</span><span class="logo-line-after"><i></i></span></a></div><h1 class="site-subtitle" itemprop="description">I'm a fatal bug!</h1></div><div class="site-nav-toggle"> <button><span class="btn-bar"></span><span class="btn-bar"></span><span class="btn-bar"></span></button></div></div><nav class="site-nav"><ul id="menu" class="menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i><br> 首页</a></li><li class="menu-item menu-item-categories"><a href="/categories.html" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i><br> 分类</a></li><li class="menu-item menu-item-archives"><a href="/archives" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i><br> 归档</a></li><li class="menu-item menu-item-tags"><a href="/tags.html" rel="section"><i class="menu-item-icon fa fa-fw fa-tag"></i><br> 标签</a></li><li class="menu-item menu-item-sitemap"><a href="/sitemap.xml" rel="section"><i class="menu-item-icon fa fa-fw fa-sitemap"></i><br> 站点地图</a></li><li class="menu-item menu-item-about"><a href="/about.html" rel="section"><i class="menu-item-icon fa fa-fw fa-user"></i><br> 关于</a></li><li class="menu-item menu-item-search"><a href="javascript:;" class="popup-trigger"><i class="menu-item-icon fa fa-search fa-fw"></i><br> 搜索</a></li></ul><div class="site-search"><div class="algolia-popup popup search-popup"><div class="algolia-search"><div class="algolia-search-input-icon"><i class="fa fa-search"></i></div><div class="algolia-search-input" id="algolia-search-input"></div></div><div class="algolia-results"><div id="algolia-stats"></div><div id="algolia-hits"></div><div id="algolia-pagination" class="algolia-pagination"></div></div><span class="popup-btn-close"><i class="fa fa-times-circle"></i></span></div></div></nav><style>.posts-expand .post-body img{border:0}</style></div></header><main id="main" class="main"><div class="main-inner"><div class="content-wrap"><div id="content" class="content"><div id="posts" class="posts-expand"><article class="post post-type-normal" itemscope="" itemtype="http://schema.org/Article"><div class="post-block"><link itemprop="mainEntityOfPage" href="https://baiyangliu.github.io/Hexo+Github+Travis-ci搭建程序员自己的博客.html"><span hidden itemprop="author" itemscope="" itemtype="http://schema.org/Person"><meta itemprop="name" content="baiyangliu"><meta itemprop="description" content=""><meta itemprop="image" content="/bug.png"></span><span hidden itemprop="publisher" itemscope="" itemtype="http://schema.org/Organization"><meta itemprop="name" content="小小白杨"></span><header class="post-header"><h2 class="post-title" itemprop="name headline">Hexo+Github+Travis-ci搭建程序员自己的博客</h2><div class="post-meta"><span class="post-time"><span class="post-meta-item-icon"><i class="fa fa-calendar-o"></i></span> <span class="post-meta-item-text">发表于</span> <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-01-11T08:31:13+08:00">2017-01-11</time></span> <span class="post-category"><span class="post-meta-divider">|</span><span class="post-meta-item-icon"><i class="fa fa-folder-o"></i></span> <span class="post-meta-item-text">分类于</span> <span itemprop="about" itemscope="" itemtype="http://schema.org/Thing"><a href="/categories/工具/" itemprop="url" rel="index"><span itemprop="name">工具</span></a></span></span> <span class="post-comments-count"><span class="post-meta-divider">|</span><span class="post-meta-item-icon"><i class="fa fa-comment-o"></i></span><a href="/Hexo+Github+Travis-ci搭建程序员自己的博客.html#comments" itemprop="discussionUrl"><span class="post-comments-count disqus-comment-count" data-disqus-identifier="Hexo+Github+Travis-ci搭建程序员自己的博客.html" itemprop="commentCount"></span></a></span> <span id="/Hexo+Github+Travis-ci搭建程序员自己的博客.html" class="leancloud_visitors" data-flag-title="Hexo+Github+Travis-ci搭建程序员自己的博客"><span class="post-meta-divider">|</span><span class="post-meta-item-icon"><i class="fa fa-eye"></i></span> <span class="post-meta-item-text">阅读次数&#58;</span><span class="leancloud-visitors-count"></span></span></div></header><div class="post-body" itemprop="articleBody"><h3 id="概述"><a href="#概述" class="headerlink" title="概述"></a>概述</h3><ul><li><a href="https://hexo.io/">Hexo</a>，NodeJS驱动的轻量级静态博客系统。</li><li>Github(Pages)，这里用来托管博客源码和发布静态页面。</li><li><a href="https://travis-ci.org/">Travis-ci</a>，持续集成，写博客要坚持，发布也要持续。<a id="more"></a></li></ul><h3 id="工作原理"><a href="#工作原理" class="headerlink" title="工作原理"></a>工作原理</h3><p><img src="" alt=""><br>说明：</p><ul><li>本地写好博客，推送到Github raw分支；</li><li>Travis-ci收到通知，触发其拉取raw并生成静态文件，然后将静态文件推送到master分支；</li><li>博客得到更新。</li></ul><h3 id="步骤"><a href="#步骤" class="headerlink" title="步骤"></a>步骤</h3><h4 id="安装Hexo"><a href="#安装Hexo" class="headerlink" title="安装Hexo"></a>安装Hexo</h4><p><a href="https://www.baidu.com/s?wd=Hexo&amp;rsv_spt=1&amp;rsv_iqid=0xd4f54a32000041cc&amp;issp=1&amp;f=8&amp;rsv_bp=1&amp;rsv_idx=2&amp;ie=utf-8&amp;rqlang=cn&amp;tn=baiduhome_pg&amp;rsv_enter=1&amp;oq=%E7%A0%81%E4%BA%91&amp;inputT=6160&amp;rsv_t=07f3ZtNYbs5NCoM%2BrC7RHj7Dd%2B6UcTWd6UNGIkfRxgqlMg4%2FSo9wUxTQlNr9%2FrYf%2BIqu&amp;rsv_pq=bfb81ab400006548&amp;rsv_n=2&amp;rsv_sug3=45&amp;rsv_sug1=47&amp;rsv_sug7=100&amp;rsv_sug2=0&amp;rsv_sug4=6161&amp;rsv_sug=2">网上</a>大把的教程。</p><h4 id="申请或登录Github帐号"><a href="#申请或登录Github帐号" class="headerlink" title="申请或登录Github帐号"></a><a href="https://github.com/join?source=header-home">申请</a>或<a href="https://github.com/login">登录</a>Github帐号</h4><p>国内的也可以申请<a href="https://coding.net/">Coding</a>、<a href="https://git.oschina.net/">OSChina</a>等，原理以及所有操作都一样。</p><h4 id="新建Repository"><a href="#新建Repository" class="headerlink" title="新建Repository"></a>新建Repository</h4><p>注意名字，例如：本人的Github帐号是<font style="color:red"><strong>baiyangliu</strong></font>，那么你新建的这个Repository名字<font style="color:red"><strong>必须是baiyangliu.github.io</strong></font>，原因不作多说。</p><h4 id="新建raw分支"><a href="#新建raw分支" class="headerlink" title="新建raw分支"></a>新建raw分支</h4><p>将Hexo源码文件放到raw分支，push到Github。</p><h4 id="配置Access-Token"><a href="#配置Access-Token" class="headerlink" title="配置Access Token"></a>配置Access Token</h4><p><a href="https://github.com/settings/tokens/new">打开</a>配置页，Token描述随便写（Hexo deployment），勾选和public_repo和user:email，点击Generate token，记下此token，该token<font style="color:red"><strong>只会在新建成功的时候显示一次，忘了必须删掉重新生成！！！</strong></font></p><h4 id="配置SSH公钥"><a href="#配置SSH公钥" class="headerlink" title="配置SSH公钥"></a>配置SSH公钥</h4><p>若果不想使用Coding和OSChina可以忽略这一步，Github本身也可以这么做，但是这里采用Access Token方案。<br></p><figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#注意替换成你自己的邮箱，全程直接回车。</span></span><br><span class="line">ssh-keygen -t rsa -C <span class="string">"xxxxx@xxxxx.com"</span></span><br><span class="line"><span class="comment">#将公钥添加到https://git.oschina.net/profile/sshkeys和https://coding.net/user/account/setting/keys</span></span><br><span class="line">cat ~/.ssh/id_rsa.pub</span><br><span class="line"><span class="comment">#将公钥保存下来，一会儿有用</span></span><br><span class="line">cat ~/.ssh/id_rsa</span><br></pre></td></tr></table></figure><p></p><h4 id="配置rsync"><a href="#配置rsync" class="headerlink" title="配置rsync"></a>配置rsync</h4><p><a href="https://baiyangliu.herokuapp.com/%E4%BD%BF%E7%94%A8rsync%E8%BF%9B%E8%A1%8C%E5%A2%9E%E9%87%8F%E4%BB%A3%E7%A0%81%E9%83%A8%E7%BD%B2.html">参见这里</a></p><h5 id="配置Travis-ci"><a href="#配置Travis-ci" class="headerlink" title="配置Travis-ci"></a>配置Travis-ci</h5><p>打开<a href="https://travis-ci.org/">Travis-ci</a>，选择使用Github帐号登录（Sign in with Github），如果没看到Github项目，同步一下就可以看到，配置环境变量：</p><ul><li>DEPLOY_TOKEN，填写上面在Github上生成的Access Token；</li><li>SSH_KEY，即SSH私钥<code>~/.ssh/id_rsa</code>，但是有个问题，它是多行的，可以直接用记事本编辑它，通过转义字符<code>\n</code>,将其合并成一行。</li><li>RSYNC_SECRET，rsync服务器密码。</li></ul><h4 id="新建-travis-yml文件"><a href="#新建-travis-yml文件" class="headerlink" title="新建.travis.yml文件"></a>新建.travis.yml文件</h4><p>需要注意的是，我这里将生成的静态文件同时推送到了Github、OSChina和Coding上，并且通过rsync同步到了我的个人VPS上，由于本人还申请了<a href="https://www.heroku.com/">Heroku</a>，Github的master分支更新会自动同步到Heroku上。因此，每次提交博客更新，其实同时发布到了多个地方（<a href="https://baiyangliu.com">个人VPS</a>、<a href="https://baiyangliu.github.io">Github Pages</a>、<a href="https://baiyangliu.oschina.io">OSChina Pages</a>、<a href="https://baiyangliu.coding.me">Coding Pages</a>和<a href="https://baiyangliu.herokuapp.com">Heroku</a>），我也是服了自己忒能折腾了。。。<br></p><figure class="highlight yml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">language:</span> <span class="string">node_js</span></span><br><span class="line"><span class="attr">node_js:</span> <span class="string">node</span></span><br><span class="line"><span class="attr">branches:</span></span><br><span class="line"><span class="attr">  only:</span></span><br><span class="line"><span class="bullet">    -</span> <span class="string">raw</span></span><br><span class="line"><span class="attr">before_script:</span></span><br><span class="line"><span class="bullet">  -</span> <span class="string">npm</span> <span class="string">install</span> <span class="bullet">-g</span> <span class="string">hexo</span></span><br><span class="line"><span class="bullet">  -</span> <span class="string">npm</span> <span class="string">install</span> <span class="bullet">-g</span> <span class="string">hexo-cli</span></span><br><span class="line"><span class="bullet">  -</span> <span class="string">npm</span> <span class="string">install</span> <span class="bullet">-g</span> <span class="string">gulp</span></span><br><span class="line"><span class="attr">install:</span></span><br><span class="line"><span class="bullet">  -</span> <span class="string">npm</span> <span class="string">install</span></span><br><span class="line"><span class="attr">script:</span></span><br><span class="line"><span class="bullet">  -</span> <span class="string">hexo</span> <span class="string">clean</span></span><br><span class="line"><span class="bullet">  -</span> <span class="string">hexo</span> <span class="string">g</span></span><br><span class="line"><span class="bullet">  -</span> <span class="string">gulp</span></span><br><span class="line"><span class="attr">after_success:</span></span><br><span class="line"><span class="bullet">  -</span> <span class="string">echo</span> <span class="string">$RSYNC_SECRET</span> <span class="string">&gt; rsync.secret</span></span><br><span class="line"><span class="string">  - chmod 600 rsync.secret</span></span><br><span class="line"><span class="string">  - rsync -vzrtopg --delete --progress --password-file=./rsync.secret ./public/* baiyangliu@baiyangliu.com::blog</span></span><br><span class="line"><span class="string">  - rm -rf rsync.secret</span></span><br><span class="line"><span class="string">  </span></span><br><span class="line"><span class="string">  - cd ./public</span></span><br><span class="line"><span class="string">  - git init</span></span><br><span class="line"><span class="string">  - git config --global user.name "baiyangliu" </span></span><br><span class="line"><span class="string">  - git config --global user.email "cun.liu@qq.com"</span></span><br><span class="line"><span class="string">  - git add .</span></span><br><span class="line"><span class="string">  - git commit -m "Updated by travis-ci at $(date)"</span></span><br><span class="line"><span class="string">  - git push --force https://$DEPLOY_TOKEN@github.com/baiyangliu/baiyangliu.github.io.git master:master</span></span><br><span class="line"><span class="string">  </span></span><br><span class="line"><span class="string">  - echo -e "$SSH_KEY" &gt; id_rsa</span></span><br><span class="line"><span class="string">  - chmod 600 id_rsa</span></span><br><span class="line"><span class="string">  - eval $(ssh-agent -s)</span></span><br><span class="line"><span class="string">  - ssh-add id_rsa</span></span><br><span class="line"><span class="string">  - rm -rf id_rsa</span></span><br><span class="line"><span class="string">  - ssh -o "StrictHostKeyChecking no" git@git.oschina.net</span></span><br><span class="line"><span class="string">  - ssh -o "StrictHostKeyChecking no" git@git.coding.net</span></span><br><span class="line"><span class="string">  - git push --force git@git.coding.net:baiyangliu/baiyangliu.git master:master</span></span><br><span class="line"><span class="string">  - git push --force git@git.oschina.net:baiyangliu/baiyangliu.git master:master</span></span><br></pre></td></tr></table></figure><p></p><h3 id="提交"><a href="#提交" class="headerlink" title="提交"></a>提交</h3><p>将写好的博客推送到Github raw分支，成功后，Travis-ci会自动执行编译命令，稍等片刻，博客更新成功。<br><a href="https://travis-ci.org/baiyangliu/baiyangliu.github.io"><img src="https://travis-ci.org/baiyangliu/baiyangliu.github.io.svg?branch=raw" alt="Build Status"></a></p></div><footer class="post-footer"><div class="post-tags"> <a href="/tags/Hexo/" rel="tag"># Hexo</a> <a href="/tags/Github/" rel="tag"># Github</a> <a href="/tags/Travis-ci/" rel="tag"># Travis-ci</a></div><div class="post-nav"><div class="post-nav-next post-nav-item"><a href="/使用rsync进行增量代码部署.html" rel="next" title="使用rsync进行增量代码部署"><i class="fa fa-chevron-left"></i> 使用rsync进行增量代码部署</a></div><span class="post-nav-divider"></span><div class="post-nav-prev post-nav-item"> <a href="/码农解析.00.序.html" rel="prev" title="码农解析.00.序">码农解析.00.序<i class="fa fa-chevron-right"></i></a></div></div></footer></div></article><div class="post-spread"></div></div></div><div class="comments" id="comments"><div id="disqus_thread"><noscript> Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript></div></div></div><div class="sidebar-toggle"><div class="sidebar-toggle-line-wrap"><span class="sidebar-toggle-line sidebar-toggle-line-first"></span><span class="sidebar-toggle-line sidebar-toggle-line-middle"></span><span class="sidebar-toggle-line sidebar-toggle-line-last"></span></div></div><aside id="sidebar" class="sidebar"><div class="sidebar-inner"><ul class="sidebar-nav motion-element"><li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap"> 文章目录</li><li class="sidebar-nav-overview" data-target="site-overview-wrap"> 站点概览</li></ul><section class="site-overview-wrap sidebar-panel"><div class="site-overview"><div class="site-author motion-element" itemprop="author" itemscope="" itemtype="http://schema.org/Person"> <img class="site-author-image" itemprop="image" src="/bug.png" alt="baiyangliu"><p class="site-author-name" itemprop="name">baiyangliu</p><p class="site-description motion-element" itemprop="description"></p></div><nav class="site-state motion-element"><div class="site-state-item site-state-posts"> <a href="/archives"><span class="site-state-item-count">23</span> <span class="site-state-item-name">日志</span></a></div><div class="site-state-item site-state-categories"> <a href="/categories.html"><span class="site-state-item-count">8</span> <span class="site-state-item-name">分类</span></a></div><div class="site-state-item site-state-tags"> <a href="/tags.html"><span class="site-state-item-count">17</span> <span class="site-state-item-name">标签</span></a></div></nav><div class="feed-link motion-element"><a href="/atom.xml" rel="alternate"><i class="fa fa-rss"></i> RSS</a></div><div class="links-of-author motion-element"><span class="links-of-author-item"><a href="https://github.com/baiyangliu" target="_blank" title="GitHub"><i class="fa fa-fw fa-github"></i> GitHub</a></span><span class="links-of-author-item"><a href="https://twitter.com/baiyangliu" target="_blank" title="Twitter"><i class="fa fa-fw fa-twitter"></i> Twitter</a></span><span class="links-of-author-item"><a href="https://plus.google.com/110436667035610920078" target="_blank" title="Google"><i class="fa fa-fw fa-google"></i> Google</a></span><span class="links-of-author-item"><a href="https://stackoverflow.com/users/3625792/baiyangliu" target="_blank" title="StackOverflow"><i class="fa fa-fw fa-stack-overflow"></i> StackOverflow</a></span></div><div class="links-of-blogroll motion-element links-of-blogroll-block"><div class="links-of-blogroll-title"><i class="fa fa-fw fa-link"></i> 分站</div><ul class="links-of-blogroll-list"><li class="links-of-blogroll-item"> <a href="https://baiyangliu.github.io" title="GitHub Pages" target="_blank">GitHub Pages</a></li><li class="links-of-blogroll-item"> <a href="https://baiyangliu.oschina.io" title="OSChina Pages" target="_blank">OSChina Pages</a></li><li class="links-of-blogroll-item"> <a href="https://baiyangliu.coding.me" title="Coding Pages" target="_blank">Coding Pages</a></li><li class="links-of-blogroll-item"> <a href="https://baiyangliu.herokuapp.com" title="Heroku" target="_blank">Heroku</a></li></ul></div></div></section><section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active"><div class="post-toc"><div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#概述"><span class="nav-number">1.</span> <span class="nav-text">概述</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#工作原理"><span class="nav-number">2.</span> <span class="nav-text">工作原理</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#步骤"><span class="nav-number">3.</span> <span class="nav-text">步骤</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#安装Hexo"><span class="nav-number">3.1.</span> <span class="nav-text">安装Hexo</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#申请或登录Github帐号"><span class="nav-number">3.2.</span> <span class="nav-text">申请或登录Github帐号</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#新建Repository"><span class="nav-number">3.3.</span> <span class="nav-text">新建Repository</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#新建raw分支"><span class="nav-number">3.4.</span> <span class="nav-text">新建raw分支</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#配置Access-Token"><span class="nav-number">3.5.</span> <span class="nav-text">配置Access Token</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#配置SSH公钥"><span class="nav-number">3.6.</span> <span class="nav-text">配置SSH公钥</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#配置rsync"><span class="nav-number">3.7.</span> <span class="nav-text">配置rsync</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#配置Travis-ci"><span class="nav-number">3.7.1.</span> <span class="nav-text">配置Travis-ci</span></a></li></ol></li><li class="nav-item nav-level-4"><a class="nav-link" href="#新建-travis-yml文件"><span class="nav-number">3.8.</span> <span class="nav-text">新建.travis.yml文件</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#提交"><span class="nav-number">4.</span> <span class="nav-text">提交</span></a></li></ol></div></div></section></div></aside></div></main><footer id="footer" class="footer"><div class="footer-inner"><div class="copyright">&copy; <span itemprop="copyrightYear">2018</span><span class="with-love"><i class="fa fa-heart"></i></span> <span class="author" itemprop="copyrightHolder">baiyangliu</span></div><div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div> <span class="post-meta-divider">|</span><div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a></div></div></footer><div class="back-to-top"><i class="fa fa-arrow-up"></i></div></div><script type="text/javascript">"[object Function]"!==Object.prototype.toString.call(window.Promise)&&(window.Promise=null)</script><script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script><script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script><script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script><script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script><script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script><script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script><script type="text/javascript" src="/js/src/utils.js?v=5.1.3"></script><script type="text/javascript" src="/js/src/motion.js?v=5.1.3"></script><script type="text/javascript" src="/js/src/affix.js?v=5.1.3"></script><script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.3"></script><script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.3"></script><script type="text/javascript" src="/js/src/post-details.js?v=5.1.3"></script><script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.3"></script><script id="dsq-count-scr" src="https://baiyangliu.disqus.com/count.js" async></script><script type="text/javascript">var disqus_config=function(){this.page.url="https://baiyangliu.github.io/Hexo+Github+Travis-ci搭建程序员自己的博客.html",this.page.identifier="Hexo+Github+Travis-ci搭建程序员自己的博客.html",this.page.title="Hexo+Github+Travis-ci搭建程序员自己的博客"},d=document,s=d.createElement("script");s.src="https://baiyangliu.disqus.com/embed.js",s.setAttribute("data-timestamp",""+ +new Date),(d.head||d.body).appendChild(s)</script><link rel="stylesheet" href="/lib/algolia-instant-search/instantsearch.min.css"><script src="/lib/algolia-instant-search/instantsearch.min.js"></script><script src="/js/src/algolia-search.js?v=5.1.3"></script><script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.4.js"></script><script>AV.initialize("7TjwCgNkkAXhYJXMF1NKiAT0-gzGzoHsz","MaxkKHwzeDNmKkqKsEPTNSK1")</script><script>function showTime(e){var t=new AV.Query(e),c=[],u=$(".leancloud_visitors");u.each(function(){c.push($(this).attr("id").trim())}),t.containedIn("url",c),t.find().done(function(e){var t=".leancloud-visitors-count";if(0!==e.length){for(var n=0;n<e.length;n++){var o=e[n],i=o.get("url"),s=o.get("time"),r=document.getElementById(i);$(r).find(t).text(s)}for(n=0;n<c.length;n++){i=c[n],r=document.getElementById(i);var l=$(r).find(t);""==l.text()&&l.text(0)}}else u.find(t).text(0)}).fail(function(e,t){console.log("Error: "+t.code+" "+t.message)})}function addCount(i){var e=$(".leancloud_visitors"),s=e.attr("id").trim(),r=e.attr("data-flag-title").trim(),t=new AV.Query(i);t.equalTo("url",s),t.find({success:function(e){if(0<e.length){var t=e[0];t.fetchWhenSave(!0),t.increment("time"),t.save(null,{success:function(e){$(document.getElementById(s)).find(".leancloud-visitors-count").text(e.get("time"))},error:function(e,t){console.log("Failed to save Visitor num, with error message: "+t.message)}})}else{var n=new i,o=new AV.ACL;o.setPublicReadAccess(!0),o.setPublicWriteAccess(!0),n.setACL(o),n.set("title",r),n.set("url",s),n.set("time",1),n.save(null,{success:function(e){$(document.getElementById(s)).find(".leancloud-visitors-count").text(e.get("time"))},error:function(e,t){console.log("Failed to create")}})}},error:function(e){console.log("Error:"+e.code+" "+e.message)}})}$(function(){var e=AV.Object.extend("Counter");1==$(".leancloud_visitors").length?addCount(e):1<$(".post-title-link").length&&showTime(e)})</script><script>!function(){var t=document.createElement("script"),e=window.location.protocol.split(":")[0];t.src="https"===e?"https://zz.bdstatic.com/linksubmit/push.js":"http://push.zhanzhang.baidu.com/push.js";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(t,s)}()</script></body></html>